package com.log;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class Log4jSlf4jMain {
    private static final Logger log = LoggerFactory.getLogger(Log4jSlf4jMain.class);

    public static void main(String[] args) {
        // 输出日志
        log.error("hello error");
        log.warn("hello warn");
        log.info("hello info");
        log.debug("hello debug"); // 默认不会打出这个

        String name = "张三";
        int age = 18;
        log.info("用户: {},{}", name, age);

        try {
            System.out.println(1 / 0);
        } catch (Exception e) {
            log.error("异常信息:", e);
        }
    }
}
